package com.qf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/captcha")
public class CodController {
    @RequestMapping("/toCode")
    public String toCode(){
        return "code";
    }
    @RequestMapping("/test1")
    public String test1(String captcha, HttpServletRequest request){
        String code = (String) request.getSession().getAttribute("captcha");
        if (captcha.equalsIgnoreCase(code)){
            System.out.println("验证码正确");
        }else {
            System.out.println("验证码错误");
        }
        return "hello";
    }
}
